import axios from "axios";
import { ElLoading } from 'element-plus'
// import { ElLoading } from 'element-plus'
const service=axios.create({
    baseURL:'',
    timeout:5000,
    headers:{
        "Content-Type":"application/json;charset=utf-8"
    }
})
//请求拦截
service.interceptors.request.use((config)=>{
    // ElLoading.service()
    ElLoading.service()
    return config
},error=>{
    return Promise.reject(error)
})
//响应拦截
service.interceptors.response.use((res)=>{
    ElLoading.service().close()
    return res
},error=>{
    // console.log(error)
    ElLoading.service().close()
    return Promise.reject(error)
})

export default service